import Vue from 'vue'
import Router from 'vue-router'
import login from "@/pages/login.vue"
import index from "@/pages/index.vue"

import head from "@/components/user/head.vue"
import account from "@/components/user/account.vue"

Vue.use(Router)
//重写push，处理冗余导航问题
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => {
    console.log(err)
  })
}

export default new Router({
  routes: [{
      path: '/',
      name: 'login',
      component: login
    },
    {
      path: '/index',
      name: 'index',
      component: index
    },
    {
      path: '/head',
      name: 'head',
      component: head
    },
    {
      path: '/account',
      name: 'account',
      component: account
    },
  ]
})
